# -*- coding: utf-8 -*-
from Page.noscanningPage import noscanningPage
from Page.reviewPage import reviewPage
import time
class review():
    def __init__(self,driver):
        self.driver=driver
        self.noscanningPage=noscanningPage(self.driver)
        self.reviewPage=reviewPage(self.driver)

# 页面刷新，切换账号
    def refresh(self):
        try:
            self.driver.refresh()
            print('刷新页面')
        except Exception as e:
            print('刷新失败')
    def newprorevpage(self):
        self.reviewPage.btnNewProReview().click()
        time.sleep(1)
    def query_review(self,GrpPropNo):
        self.driver.switch_to.default_content()
        self.driver.switch_to.frame("fraInterface")
        time.sleep(1)
        self.reviewPage.inpGrpPropNo().send_keys(GrpPropNo)
        time.sleep(1)
        self.reviewPage.btnrefer().click()
        time.sleep(1)
    def self_to_public(self):
        # 公共池
        self.reviewPage.btnGrpApproveListGridSel().click()
        time.sleep(1)
        self.reviewPage.btnapply().click()
        time.sleep(1)
        window1 = self.driver.window_handles
        self.driver.switch_to.window(window1[-1])
        self.noscanningPage.butSubmit().click()
        # 个人池
        windows2 = self.driver.window_handles
        self.driver.switch_to.window(windows2[-1])
        self.driver.switch_to.default_content()
        self.driver.switch_to.frame("fraInterface")
        time.sleep(1)
        self.reviewPage.btnSelfGrpApproveListGridSel().click()
        time.sleep(1)
        self.reviewPage.btnGoInside().click()
        time.sleep(1)
        windows3 = self.driver.window_handles
        self.driver.switch_to.window(windows3[-1])
        self.driver.switch_to.default_content()
        self.driver.switch_to.frame("fraInterface")
        self.reviewPage.btnApprove().click()
        time.sleep(1)
        window4 = self.driver.window_handles
        self.driver.switch_to.window(window4[-1])
        self.noscanningPage.butSubmit().click()






